package com.menu;

import com.company.*;

import java.io.IOException;
import java.util.Scanner;

public class LinkServerMenu {

    public void linkServerMenu() throws IOException {

        LinkCRUD linkCRUD = new LinkCRUD();
        boolean flag = true;
        while (flag){

            System.out.println("\\n请选择服务的种类：\\n");
            System.out.println("\t1.链表读取文件");
            System.out.println("\t2.链表添加道路");
            System.out.println("\t3.链表查询道路信息");
            System.out.println("\t4.链表修改信息");
            System.out.println("\t5.链表删除信息");
            System.out.println("\t6.链表排序道路信息");
            System.out.println("\t7.转顺序表存储");
            System.out.println("\t0.退出");
            System.out.print("\t请选择：");

            int sc = -1;
            try{
                Scanner scanner = new Scanner(System.in);
                sc = scanner.nextInt();
            }catch (Exception e) {
                System.out.println("错误有误,请重新输入");
            }
            switch (sc){
                case 1:{

                    linkCRUD.linkReadFileToString();
                    break;
                }
                case 2:{
                    linkCRUD.linkInsert();
                    break;
                }
                case 3:{
                    linkCRUD.linkSerch();
                    break;
                }
                case 4:{
                    linkCRUD.linkUpdate();
                    break;
                }
                case 5:{
                    linkCRUD.linkedDelete();
                    break;
                }
                case 6:{
                    SortLinkMenu slm = new SortLinkMenu();
                    slm.linkMenu();
                    break;
                }
                case 7:{
                    ArrayServerMenu sm = new ArrayServerMenu();
                    sm.serverMenu();
                    break;
                }
                case 0:{
                    flag = false;
                    break;
                }
                default:{
                    System.out.println("输入有误，请重新输入：");
                    break;
                }
            }
        }

    }



}



